package org.nepu.scr.indexrate.converter.drillingrate.jobsupport;

import cn.hutool.json.JSONUtil;
import org.nepu.scr.indexrate.vo.drillingrate.jobsupport.CraneCapacity;

import javax.persistence.AttributeConverter;
import javax.persistence.Convert;

@Convert
public class CraneCapacityConverter implements AttributeConverter<CraneCapacity, String> {
    @Override
    public String convertToDatabaseColumn(CraneCapacity craneCapacity) {
        return JSONUtil.toJsonStr(craneCapacity);
    }

    @Override
    public CraneCapacity convertToEntityAttribute(String s) {
        return JSONUtil.toBean(s, CraneCapacity.class);
    }
}
